﻿#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;

class PersonInitList
{
public:
	/*PersonInitList()
	{
	}*/
	//1.有参构造初始化数据；
	/*PersonInitList(int a, int b, int c)
	{
		m_A = a;
		m_B = b;
		m_C = c;
	}*/

	PersonInitList() :m_A(40), m_B(50), m_C(60)
	{
	}
	//2.利用初始化列表，初始化数据；构造函数的后面，+ ：属性（参数），属性（参数）...
	PersonInitList(int a, int b, int c) :m_A(a), m_B(b), m_C(c)
	{
	}

	int m_A;
	int m_B;
	int m_C;
};
void testInitList()
{
	PersonInitList p1(10, 20, 30);
	cout << "p1的m_A：" << p1.m_A << endl;//10
	cout << "p1的m_B：" << p1.m_B << endl;//20
	cout << "p1的m_C：" << p1.m_C << endl;//30

	PersonInitList p2;
	cout << "p2的m_A：" << p2.m_A << endl;//40
	cout << "p2的m_B：" << p2.m_B << endl;//50
	cout << "p2的m_C：" << p2.m_C << endl;//60
}

//main262：初始化列表的基本用法
int main262()
{
	testInitList();

	system("pause");
	return EXIT_SUCCESS;
}